package com.yanqu.road.entity.activity.fellingtrees;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.entity.DataStatus;
import com.yanqu.road.utils.property.Property;

import java.math.BigInteger;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@FieldTypeAnnotation(tableName = "t_u_felling_trees_user")
public class FellingTreesUserData extends DataObject {

    @FieldTypeAnnotation(desc = "活动ID", select = true, update = true)
    private int activityId;
    @FieldTypeAnnotation(desc = "玩家ID", select = true, update = true)
    private long userId;

    @FieldTypeAnnotation(desc = "金币")
    private BigInteger gold;

    @FieldTypeAnnotation(desc = "攻击力")
    private BigInteger attack;
    @FieldTypeAnnotation(desc = "最高砍树等级")
    private int topLevel;

    @FieldTypeAnnotation(desc = "装备栏，-1未解锁，0未装备，大于0装备uid")
    private long[] equipPosArr;
    @FieldTypeAnnotation(desc = "所有装备")
    private Map<Long, FellingTreesEquip> equipMap = new ConcurrentHashMap<>();
    @FieldTypeAnnotation(desc = "所有材料")
    private Property items = new Property();
    @FieldTypeAnnotation(desc = "最大装备uid")
    private long maxUid;

    @FieldTypeAnnotation(desc = "buff")
    private Map<Integer, Integer> buffMap = new ConcurrentHashMap<>();

    @FieldTypeAnnotation(desc = "体力")
    private int energy;
    @FieldTypeAnnotation(desc = "体力恢复时间")
    private long recoveryTime;

    @FieldTypeAnnotation(desc = "玉兔体力（5.1废弃）")
    private int rabbitEnergy;
    @FieldTypeAnnotation(desc = "玉兔体力恢复时间（5.1废弃）")
    private long rabbitRecoveryTime;
    @FieldTypeAnnotation(desc = "玉兔引导")
    private boolean rabbitGuide;

    @FieldTypeAnnotation(desc = "最后一次砍树的等级")
    private int lastLevel;
    @FieldTypeAnnotation(desc = "最后一次砍树剩余血量")
    private BigInteger lastHp;

    @FieldTypeAnnotation(desc = "法宝设置")
    private FellingTreesSetting setting;

    @FieldTypeAnnotation(desc = "灵宝引导")
    private boolean specialEquipGuide;

    @FieldTypeAnnotation(desc = "月灵石引导")
    private boolean daoqiGuide;


    // ============================================================

    public int getActivityId() {
        return activityId;
    }

    public void setActivityId(int activityId) {
        if (this.activityId != activityId) {
            this.activityId = activityId;
            setOp(DataStatus.Update);
        }
    }

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        if (this.userId != userId) {
            this.userId = userId;
            setOp(DataStatus.Update);
        }
    }

    public BigInteger getAttack() {
        return attack;
    }

    public void setAttack(BigInteger attack) {
        if (attack == null) {
            return;
        }
        if (this.attack == null || !this.attack.equals(attack)) {
            this.attack = attack;
            setOp(DataStatus.Update);
        }
    }

    public int getTopLevel() {
        return topLevel;
    }

    public void setTopLevel(int topLevel) {
        if (this.topLevel != topLevel) {
            this.topLevel = topLevel;
            setOp(DataStatus.Update);
        }
    }

    public long[] getEquipPosArr() {
        return equipPosArr;
    }

    public void setEquipPosArr(long[] equipPosArr) {
        if (null == equipPosArr) {
            return;
        }
        this.equipPosArr = equipPosArr;
        setOp(DataStatus.Update);
    }

    public Map<Long, FellingTreesEquip> getEquipMap() {
        return equipMap;
    }

    public void setEquipMap(ConcurrentHashMap<Long, FellingTreesEquip> equipMap) {
        if (null == equipMap) {
            return;
        }
        this.equipMap = equipMap;
        setOp(DataStatus.Update);
    }

    public Property getItems() {
        return items;
    }

    public void setItems(Property items) {
        if (null == items) {
            return;
        }
        this.items = items;
        setOp(DataStatus.Update);
    }

    public long getMaxUid() {
        return maxUid;
    }

    public void setMaxUid(long maxUid) {
        if (this.maxUid != maxUid) {
            this.maxUid = maxUid;
            setOp(DataStatus.Update);
        }
    }

    public Map<Integer, Integer> getBuffMap() {
        return buffMap;
    }

    public void setBuffMap(ConcurrentHashMap<Integer, Integer> buffMap) {
        if (null == buffMap) {
            return;
        }
        this.buffMap = buffMap;
        setOp(DataStatus.Update);
    }

    public int getEnergy() {
        return energy;
    }

    public void setEnergy(int energy) {
        if (this.energy != energy) {
            this.energy = energy;
            setOp(DataStatus.Update);
        }
    }

    public long getRecoveryTime() {
        return recoveryTime;
    }

    public void setRecoveryTime(long recoveryTime) {
        if (this.recoveryTime != recoveryTime) {
            this.recoveryTime = recoveryTime;
            setOp(DataStatus.Update);
        }
    }

    public int getRabbitEnergy() {
        return rabbitEnergy;
    }

    public void setRabbitEnergy(int rabbitEnergy) {
        if (this.rabbitEnergy != rabbitEnergy) {
            this.rabbitEnergy = rabbitEnergy;
            setOp(DataStatus.Update);
        }
    }

    public long getRabbitRecoveryTime() {
        return rabbitRecoveryTime;
    }

    public void setRabbitRecoveryTime(long rabbitRecoveryTime) {
        if (this.rabbitRecoveryTime != rabbitRecoveryTime) {
            this.rabbitRecoveryTime = rabbitRecoveryTime;
            setOp(DataStatus.Update);
        }
    }

    public boolean isRabbitGuide() {
        return rabbitGuide;
    }

    public void setRabbitGuide(boolean rabbitGuide) {
        if (this.rabbitGuide != rabbitGuide) {
            this.rabbitGuide = rabbitGuide;
            setOp(DataStatus.Update);
        }
    }

    public int getLastLevel() {
        return lastLevel;
    }

    public void setLastLevel(int lastLevel) {
        if (this.lastLevel != lastLevel) {
            this.lastLevel = lastLevel;
            setOp(DataStatus.Update);
        }
    }

    public BigInteger getLastHp() {
        return lastHp;
    }

    public void setLastHp(BigInteger lastHp) {
        if (lastHp == null) {
            return;
        }
        if (this.lastHp == null || !this.lastHp.equals(lastHp)) {
            this.lastHp = lastHp;
            setOp(DataStatus.Update);
        }
    }

    public FellingTreesSetting getSetting() {
        return setting;
    }

    public void setSetting(FellingTreesSetting setting) {
        if (null == setting) {
            return;
        }
        this.setting = setting;
        setOp(DataStatus.Update);
    }

    public BigInteger getGold() {
        return gold;
    }

    public void setGold(BigInteger gold) {
        if (gold == null) {
            return;
        }
        if (this.gold == null || !this.gold.equals(gold)) {
            this.gold = gold;
            setOp(DataStatus.Update);
        }
    }

    public boolean isSpecialEquipGuide() {
        return specialEquipGuide;
    }

    public void setSpecialEquipGuide(boolean specialEquipGuide) {
        if (this.specialEquipGuide != specialEquipGuide) {
            this.specialEquipGuide = specialEquipGuide;
            setUpdateOption();
        }
    }

    public boolean isDaoqiGuide() {
        return daoqiGuide;
    }

    public void setDaoqiGuide(boolean daoqiGuide) {
        if (this.daoqiGuide != daoqiGuide) {
            this.daoqiGuide = daoqiGuide;
            setUpdateOption();
        }
    }
}
